package com.mybatisx.mybatisplus.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.mybatisx.mybatisplus.entity.Master;
import com.mybatisx.mybatisplus.mapper.MasterMapper;
import com.mybatisx.mybatisplus.service.MasterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wuyue
 * @since 2021-09-09
 */
@Service
@DS("db0")
public class MasterServiceImpl extends ServiceImpl<MasterMapper, Master> implements MasterService {

            @Autowired
            private  MasterMapper masterMapper;

            @Override
            @DS("db0")
            public void selectById01(int id) {
                Master master = masterMapper.selectById(id);
                System.out.println("-----------"+ master.getTitle());
            }

            @Override
            @DS("db1")
            public void selectById02(int id) {
               Master master = masterMapper.selectById(id);
                System.out.println( "-----------"+ master.getTitle());
            }

              @Override
             @DS("db2")
            public void selectById03(int id) {
                Master master = masterMapper.selectById(id);
                System.out.println("-----------"+ master.getTitle());
            }


}
